home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 414_02 / portable / startcol.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-17  |  1.5 KB  |  56 lines

  1. #define    CURSES_LIBRARY    1
  2. #include <curses.h>
  3. #undef start_color
  4.  
  5. #ifdef PDCDEBUG
  6. char *rcsid_startcol = "$Header: C:\CURSES\portable\RCS\startcol.c 2.1 1993/06/18 20:21:15 MH Rel MH $";
  7. #endif
  8.  
  9.  
  10.  
  11.  
  12. /*man-start*********************************************************************
  13.  
  14.   start_color()    - Initialize and set up curses for color mode.
  15.  
  16.   PDCurses Description:
  17.      This routine sets up curses to enable color support.
  18.  
  19.      Eight basic color are initialized: black, blue, green, cyan, red,
  20.      magenta, yellow and white. Two global variables - COLORS and
  21.      COLOR_PAIRS, as defined in <curses.h> header file - are also
  22.      initialized. The se variables define the maximum number of colors
  23.      and the maximum number of color-pairs supported.
  24.  
  25.      This routine must be called before any other curses routine which
  26.      manipulates or uses colors. A good place to call it is immediately
  27.      after initscr().
  28.  
  29.   PDCurses Return Value:
  30.      This function returns ERR if the monitor does not support color.
  31.      Otherwise OK is returned.
  32.  
  33.   PDCurses Errors:
  34.      N/A
  35.  
  36.   Portability:
  37.      PDCurses    int start_color(void);
  38.      SYS V curses    int start_color(void);
  39.  
  40. **man-end**********************************************************************/
  41.  
  42. int COLORS=0,COLOR_PAIRS=0;
  43.  
  44. int start_color(void)
  45. {
  46. #ifdef PDCDEBUG
  47.     if (trace_on) PDC_debug("start_color() - called\n");
  48. #endif
  49.  
  50.  if (_cursvar.mono)
  51.     return(ERR);
  52.  COLORS = 8;
  53.  COLOR_PAIRS = 33;  /* actually only allows 32 */
  54.  return(OK);
  55. }
  56.